<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/20
 * Time: 10:26
 */

namespace app\index\controller;




use app\index\model\Member;

class TeamController extends BaseController
{

    public function teamList(){
        $user_id = (int)input('post.user_id');
        $page = (int)input('post.page');
        $number = (int)input('post.number');
        if ($user_id == 0){
            return json(['code'=>0,'msg'=>'用户ID不能为0！']);
        }
        $data = Member::with(['team'=>function ($query){
            $query->field('user_id,total_sum,order_num,brokerage_A,brokerage_B');
        }])->where('pid',$user_id)
            ->field('id,wx_nickname,wx_image,create_time')
            ->limit(($page - 1) * $number,$number)->select();
        return json(['code'=>1,'msg'=>'查询成功','data'=>$data]);
    }




}